import 'package:flutter/services.dart';

class AdbFlutter {
  static const methodChannel = MethodChannel('adb_flutter');
  static const eventChannel = EventChannel('adb_flutter_event');
  static Stream get stream => eventChannel.receiveBroadcastStream();
  static Future<String?> connect(String ipAddress, int port) async {
    return await methodChannel.invokeMethod('connect', {
      "ipAddress": ipAddress,
      "port": port,
    });
  }

  static Future<String?> autoConnect(String ipAddress, int port) async {
    return await methodChannel.invokeMethod('autoConnect', {
      "ipAddress": ipAddress,
      "port": port,
    });
  }

  static Future<String?> close() async {
    return await methodChannel.invokeMethod('close');
  }

  static Future<String?> disconnect() async {
    return await methodChannel.invokeMethod('disconnect');
  }

  static Future<String?> execute(String command) async {
    return await methodChannel.invokeMethod('execute', {"command": command});
  }
}
